/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Current.Armory;

import Current.Armory.Items.OffenseItems;

import java.io.Serializable;

/**
 * @author Fork
 */
public class OffenseArmory implements Armory, Serializable, Cloneable {

    private OffenseItems weapons;
    private OffenseItems helms;
    private OffenseItems armors;
    private OffenseItems boots;
    private OffenseItems bracers;
    private OffenseItems shields;
    private Integer soldiers;

    public OffenseArmory(Integer Soldiers, OffenseItems weapons, OffenseItems helms, OffenseItems armor, OffenseItems boots, OffenseItems bracers, OffenseItems shields) {
        this.weapons = weapons;
        this.helms = helms;
        this.armors = armor;
        this.boots = boots;
        this.bracers = bracers;
        this.shields = shields;
        this.soldiers = Soldiers;
    }

    public OffenseArmory(Integer Soldiers) {
        this.weapons = new OffenseItems(0, 12500, 25);
        this.helms = new OffenseItems(0, 3000, 6);
        this.armors = new OffenseItems(0, 9500, 19);
        this.boots = new OffenseItems(0, 3000, 6);
        this.bracers = new OffenseItems(0, 1500, 3);
        this.shields = new OffenseItems(0, 6000, 12);
        this.soldiers = Soldiers;
    }

    public OffenseItems getArmors() {
        return armors;
    }

    public void setArmors(OffenseItems armors) {
        this.armors = armors;
    }

    public OffenseItems getBoots() {
        return boots;
    }

    public void setBoots(OffenseItems boots) {
        this.boots = boots;
    }

    public OffenseItems getBracers() {
        return bracers;
    }

    public void setBracers(OffenseItems bracers) {
        this.bracers = bracers;
    }

    public OffenseItems getHelms() {
        return helms;
    }

    public void setHelms(OffenseItems helms) {
        this.helms = helms;
    }

    public OffenseItems getShields() {
        return shields;
    }

    public void setShields(OffenseItems shields) {
        this.shields = shields;
    }

    public OffenseItems getWeapons() {
        return weapons;
    }

    public void setWeapons(OffenseItems weapons) {
        this.weapons = weapons;
    }

    public int getSetOffenseBonus() {
        int aux = 0;

        aux += this.weapons.getOffenseIncrease();
        aux += this.helms.getOffenseIncrease();
        aux += this.armors.getOffenseIncrease();
        aux += this.boots.getOffenseIncrease();
        aux += this.bracers.getOffenseIncrease();
        aux += this.shields.getOffenseIncrease();

        return aux;
    }

    public int getSetCost() {
        int aux = 0;

        aux += this.weapons.getCostToBuy();
        aux += this.helms.getCostToBuy();
        aux += this.armors.getCostToBuy();
        aux += this.boots.getCostToBuy();
        aux += this.bracers.getCostToBuy();
        aux += this.shields.getCostToBuy();

        return aux;
    }

    private int getOffenseFromWeapons() {
        if (this.weapons.getHave() >= soldiers) {
            return this.weapons.getOffenseIncrease() * soldiers;
        } else {
            return this.weapons.getOffenseIncrease() * this.weapons.getHave();
        }
    }

    private int getOffenseFromHelms() {
        if (this.helms.getHave() >= soldiers) {
            return this.helms.getOffenseIncrease() * soldiers;
        } else {
            return this.helms.getOffenseIncrease() * this.helms.getHave();
        }
    }

    private int getOffenseFromArmors() {
        if (this.armors.getHave() >= soldiers) {
            return this.armors.getOffenseIncrease() * soldiers;
        } else {
            return this.armors.getOffenseIncrease() * this.armors.getHave();
        }
    }

    private int getOffenseFromBoots() {
        if (this.boots.getHave() >= soldiers) {
            return this.boots.getOffenseIncrease() * soldiers;
        } else {
            return this.boots.getOffenseIncrease() * this.boots.getHave();
        }
    }

    private int getOffenseFromBracers() {
        if (this.bracers.getHave() >= soldiers) {
            return this.bracers.getOffenseIncrease() * soldiers;
        } else {
            return this.bracers.getOffenseIncrease() * this.bracers.getHave();
        }
    }

    private int getOffenseFromShields() {
        if (this.shields.getHave() >= soldiers) {
            return this.shields.getOffenseIncrease() * soldiers;
        } else {
            return this.shields.getOffenseIncrease() * this.shields.getHave();
        }
    }

    public int getTotalOffenseBonus() {
        int aux = 0;

        aux += getOffenseFromWeapons();
        aux += getOffenseFromHelms();
        aux += getOffenseFromArmors();
        aux += getOffenseFromBoots();
        aux += getOffenseFromBracers();
        aux += getOffenseFromShields();

        return aux;
    }

    public Integer getSoldiers() {
        return soldiers;
    }

    public void setSoldiers(Integer soldiers) {
        this.soldiers = soldiers;
    }


}
